/*
 * Copyright (c) 2020, Wingbow
 *
 * Change Logs:
 * Date           Author       Notes
 * 2020-02-28     MAMAMA       first version
 */

#include "stm32f10x.h"
#include "wingbot.h"
#include <rtthread.h>

static rt_thread_t led_blink_thread = RT_NULL;

void led_blink_entry(void* param)
{
    Wing::Led led;
    led.init();
    while(true)
    {
        led.on_off(true);
        rt_thread_mdelay(200);
        led.on_off(false);
        rt_thread_mdelay(200);
    }
}

int main(void)
{
    led_blink_thread = rt_thread_create(
        "led_blink",    //thread name
        led_blink_entry,//entry
        RT_NULL,        //parameter
        512,            //thread stack size
        10,              //priority
        20              //时间片大小
    );

    if (led_blink_thread != RT_NULL)
        rt_thread_startup(led_blink_thread);
    else
        rt_kprintf("led_blink init failed.\n");
    
    return 0;
}
